import request from '@/utils/request'

// 查询结算协议列表
export function listAgreement(query) {
  return request({
    url: '/agreement/agreement/list',
    method: 'get',
    params: query
  })
}

// 查询结算协议详细
export function getAgreement(agreementCode) {
  return request({
    url: '/agreement/agreement/' + agreementCode,
    method: 'get'
  })
}

// 新增结算协议
export function addAgreement(data) {
  return request({
    url: '/agreement/agreement',
    method: 'post',
    data: data
  })
}

// 修改结算协议
export function updateAgreement(data) {
  return request({
    url: '/agreement/agreement',
    method: 'put',
    data: data
  })
}

// 删除结算协议
export function delAgreement(agreementCode) {
  return request({
    url: '/agreement/agreement/' + agreementCode,
    method: 'delete'
  })
}

//根据合作方编码获取合作方协议
export function getAgreementByPartnerCode(partnerCode) {
  return request({
    url: '/agreement/agreement/getAgreementByPartnerCode',
    method: 'post',
    params: {
      partnerCode
    }
  })
}



//根据合作方编码获取合作方协议
export function getAgreementCodeByPartnerCode(partnerCode) {
  return request({
    url: '/agreement/agreement/getAgreementCodeByPartnerCode',
    method: 'post',
    data: partnerCode, // 直接传递字符串
  })
}

